﻿using Abp.vNext.WT.Domain.Issues;
using Abp.vNext.WT.EntityFrameworkCore.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace Abp.vNext.WT.EntityFrameworkCore.Issues
{
    public class IssueRepository : EfCoreRepository<WebApiDbContext, Issue, Guid>, IIssueRepository
    {
        public IssueRepository(IDbContextProvider<WebApiDbContext> dbContextProvider) : base(dbContextProvider)
        {

        }

        public async Task<int> GetIssueCountOfUserAsync(Guid userId)
        {
            var query = await GetQueryableAsync();
            //var isse=query.FirstOrDefault();
            return await query.Where(x => x.AssignedUserId == userId).CountAsync();
        }

    }
}
